package com.demo.search.model;

import java.util.Date;

/**
 * 检索任务模型
 * 记录表的变化用以更新索引
 * @author ryuu.kk
 *
 */
public class SearchTask implements java.io.Serializable {

	/**
	 * 版本序列化ID
	 */
	private static final long serialVersionUID = 5003383121834853230L;

	public static enum Operate {
		Create {
			@Override
		    public int get()  { return 1<<0; }},
		Update {
			@Override
			public int get() {	return 1<<1;	}},
		Delete {
			@Override
			public int get() {	return 1<<2;	}};
	    public abstract int get();
	    
	    public static Operate get(int c) {
	    	Operate o = null;
	    	switch(c) {
	    		case 1<<0:
	    			o = Operate.Create;
	    			break;
	    		case 1<<1:
	    			o = Operate.Update;
	    			break;
	    		case 1<<2:
	    			o = Operate.Delete;
	    			break;
	    		default :
	    			o = Operate.Create;
	    	}
	    	return o;
	    }
	}
	
	public static enum Status {
		Wait {
			@Override
			public int get() {	return 1<<0; }},
		Finished {
			@Override
			public int get() {	return 1<<1; }},
		Retry {
			@Override
			public int get() {	return 1<<2; }},
		Undo {
			@Override
			public int get() {	return 1<<3; }};
		public abstract int get();
	}
	
	/**
	 * 代理主键ID
	 */
	private Long id;
	
	/**
	 * 站点外键ID
	 */
	private Long siteId;
	
	/**
	 * 目标代理主键Long
	 */
	private Long targetId;
	
	/**
	 * 目标类型
	 */
	private String targetType;
	
	/**
	 * 操作类型:(CURD)
	 */
	private int handleOpt;
	
	/**
	 * 处理状态(w:wait f:finished retry:r u:undo)
	 */
	private int handleStatus;
	
	/**
	 * 处理时间
	 */
	private Date handleTime;
	
	/**
	 * 创建时间
	 */
	private Date createTime;
	
	/**
	 * 备注
	 */
	private String notes;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getSiteId() {
		return siteId;
	}

	public void setSiteId(Long siteId) {
		this.siteId = siteId;
	}

	public Long getTargetId() {
		return targetId;
	}

	public void setTargetId(Long targetId) {
		this.targetId = targetId;
	}

	public String getTargetType() {
		return targetType;
	}

	public void setTargetType(String targetType) {
		this.targetType = targetType;
	}

	public int getHandleOpt() {
		return handleOpt;
	}

	public void setHandleOpt(int handleOpt) {
		this.handleOpt = handleOpt;
	}

	public int getHandleStatus() {
		return handleStatus;
	}

	public void setHandleStatus(int handleStatus) {
		this.handleStatus = handleStatus;
	}

	public Date getHandleTime() {
		return handleTime;
	}

	public void setHandleTime(Date handleTime) {
		this.handleTime = handleTime;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getNotes() {
		return notes;
	}

	public void setNotes(String notes) {
		this.notes = notes;
	}
}
